package club.terroir.client.produit;

import java.util.Iterator;

import com.google.gwt.user.client.ui.Tree;
import com.google.gwt.user.client.ui.TreeItem;

public class UtilTree {
	/**
	 * Essaye d'ouvrir le nouvel arbre au meme endroit/folder que le precedent
	 * @param tree
	 * @param tOld
	 */
	public static void open(Tree tree, Tree tOld) {
		Iterator<TreeItem> iteratorOld = tOld.treeItemIterator();
		Iterator<TreeItem> iterator2 = tree.treeItemIterator();
		while(iteratorOld.hasNext()){
			TreeItem itemOld = iteratorOld.next();
			if (iterator2.hasNext()){
				TreeItem item =iterator2.next();
				item.setState(itemOld.getState());
			}
		}
		
	}

}
